package oj;

import java.util.Scanner;

public class Day47F {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            int[] arr = new int[n + 1];
            for (int i = 1; i <= n; i++) {
                arr[i] = sc.nextInt();
            }
            int k = sc.nextInt();
            int d = sc.nextInt();

            //创建最大值和最小值两个辅助数组
            long[][] f = new long[n + 1][k + 1];
            long[][] g = new long[n + 1][k + 1];

            //初始化两个数组，即K=1的情况
            for (int i = 1; i <= n; i++) {
                f[i][1] = arr[i];
                g[i][1] = arr[i];
            }
            //从k=2开始填充（遍历每一行）
            for (int curK = 2; curK <= k; curK++) {
                for (int curN = curK; curN <= n; curN++) {
                    long tempMax = Long.MIN_VALUE;
                    long tempMin = Long.MAX_VALUE;
                    //根据left的两个边界条件进行遍历
                    for (int left = Math.max(curK - 1, curN - d); left <= curN - 1; left++) {
                        //根据所得的递推公式更新最小值 最大值
                        if (tempMax < Math.max(f[left][curK - 1] * arr[curN], g[left][curK - 1] * arr[curN])) {
                            tempMax = Math.max(f[left][curK - 1] * arr[curN], g[left][curK - 1] * arr[curN]);
                        }
                        if (tempMin > Math.min(f[left][curK - 1] * arr[curN], g[left][curK - 1] * arr[curN])) {
                            tempMin = Math.min(f[left][curK - 1] * arr[curN], g[left][curK - 1] * arr[curN]);

                        }
                    }
                    f[curN][curK] = tempMax;
                    g[curN][curK] = tempMin;
                }

            }
            //确定了K值，要得到最大值，则遍历第K列
            long maxResult = Long.MIN_VALUE;
            for (int curN = k; curN <= n; curN++) {
                if (f[curN][k] > maxResult) {
                    maxResult = f[curN][k];
                }
            }
            System.out.println(maxResult);
        }
    }
}
